package com.conf;

import java.util.Properties;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Parameters {
	
	private static Properties properties = new Properties();
	
	
	public final static String USER_ATTRIBUTE = "userAttribute";
	public final static int USER_ADMINISTRADOR = 1;
	public final static int USER_DIAGRAMADOR = 2;
	public final static int USER_CHOFER = 3;
	
	public static String DB_HOST ="";
	public static String DB_PORT="";
	public static String DB_NAME="";
	public static String DB_USER="";
	public static String DB_PASS="";
	
	public final static String ACTION_PATH="/routeAdmin";
	
	static{
		Parameters.init();
	}
	private static void init(){
		try {
			String url=Parameters.class.getProtectionDomain().getCodeSource().getLocation().getPath();
			url=url.split("Parameters")[0];
			//InputStream in=ClassLoader.getSystemClassLoader().getResourceAsStream(url+"config.properties");
			FileInputStream s=new FileInputStream(url+"config.properties");
			properties.load(s);
			Parameters.DB_HOST=properties.getProperty("DB_HOST");
			Parameters.DB_PORT=properties.getProperty("DB_PORT");
			Parameters.DB_NAME=properties.getProperty("DB_NAME");
			Parameters.DB_USER=properties.getProperty("DB_USER");
			Parameters.DB_PASS=properties.getProperty("DB_PASS");
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	

}
